package cn.byapps.hw.service.impl;

import cn.byapps.hw.dao.CronDao;
import cn.byapps.hw.entity.Cron;
import cn.byapps.hw.service.CronService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.transaction.Transactional;

@Service
@Transactional
public class CronServiceImpl implements CronService {

    @Resource
    private CronDao cronDao;

    @Override
    public void add(Cron cron) {
        cronDao.save(cron);
    }

    @Override
    public void update(Cron cron) {
        cronDao.saveAndFlush(cron);
    }

    @Override
    public Cron getById(Integer id) {
        return cronDao.findById(id).get();
    }
}
